<#include "/public/macro.html">
<div class="uk-layui-form">
    <form class="layui-form uk-form" action="/admin/callcenter/extention/ivr/update.html" method="post" data-toggle="ajax-form" data-inner="#callCenterContent">
    	<input type="hidden" name="hostid" value="${pbxHost.id!''}">
    	<input type="hidden" name="id" value="${extention.id!''}">
    	<input type="hidden" name="p" value="${p!''}">
    	<#if ismy?? && ismy>
		<input type="hidden" name="ismy" value="true">
		</#if>
    	<div class="layui-form-item">
	    	<label class="layui-form-label">智能IVR对接地址：</label>
	        <div class="layui-input-inline">
	        	<input type="text" readOnly="readonly" style="width:450px;"  autocomplete="off" class="layui-input" value="${schema!''}://${hostname!''}:${port?string('###')}/apps/robotsmartivr/asr">
	        </div>
	    </div>

    	<div class="layui-form-item">
            <label class="layui-form-label">启用机器人类型：</label>
            <div class="layui-input-inline" style="width: 400px;">
            	<input type="radio" title="IVR" name="aitype" id="enableai" value="ivr" lay-filter="enable_ivr" <#if extention?? && extention.aitype == 'ivr'>checked="checked"</#if>>
                <input type="radio" title="智能机器人" name="aitype" id="enableai" value="smartai" lay-filter="enable_ai" <#if extention?? && extention.aitype == 'smartai'>checked="checked"</#if>>
				<#if models?? && models["calloutai"]?? && models["calloutai"] == true >
				<input type="radio" title="业务机器人" name="aitype" id="enableai" value="businessai" lay-filter="bus_ai" <#if extention?? && extention.aitype == 'businessai'>checked="checked"</#if>>
				</#if>
            </div>
        </div>

        <div class="box-item" id="ai_tip" style="<#if !(extention?? && extention.aitype == 'smartai')>display:none;</#if>">	
	        <div class="layui-form-item">
	            <label class="layui-form-label">选择智能机器人：</label>
	            <div class="layui-input-inline" style="width:450px;">
	                <select name="aiid" style="width:450px;">
						<option value="">请选择默认的机器人</option>
						<#if serviceAiList??>
						<#list serviceAiList as serviceAi>
						<option value="${serviceAi.id!''}" <#if extention.aiid?? && extention.aiid == serviceAi.id>selected="selected"</#if>>${serviceAi.name!''}</option>
						</#list>
						</#if> 
					</select>
	            </div>
	        </div>
			<#--<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">语种/方言：</label>
					<div class="layui-input-inline">
						<@select2 "com.dic.sales.lang" "language" extention.language!'' " " "" "请选择语种/方言"/>
					</div>
				</div>
			</div>-->
	        <div class="layui-form-item">
	            <label class="layui-form-label">欢迎提示语：</label>
	            <div class="layui-input-inline">
	               <textarea id="welcomemsg" style="width:450px;" name="welcomemsg" class="layui-textarea">${extention.welcomemsg!"您好，欢迎致电优客服智能IVR演示系统，这里是电话机器人演示系统，请说要进入的测试流程，比如，客服系统！"}</textarea>
	            </div>
	        </div>
	        
	        <div class="layui-form-item">
	            <label class="layui-form-label">无对话提示语：</label>
	            <div class="layui-input-inline">
	            	<input type="text" id="waitmsg" style="width:450px;" name="waitmsg" style="width:450px;"  autocomplete="off" class="layui-input" value="${extention.waitmsg!'请说话测试吧'}">
	            </div>
	        </div>
	        
	        <div class="layui-form-item">
	            <label class="layui-form-label">查询等待提示语：</label>
	            <div class="layui-input-inline">
	            	<input type="text" id="tipmessage" style="width:450px;" name="tipmessage" style="width:450px;"  autocomplete="off" class="layui-input" value="${extention.tipmessage!'正在为您查询 ，请稍候'}">
	            </div>
	        </div>
	        
	        <div class="layui-form-item">
	            <label class="layui-form-label">异常提示语：</label>
	            <div class="layui-input-inline">
	            	<input type="text" id="errormessage" style="width:450px;" name="errormessage" style="width:450px;"  autocomplete="off" class="layui-input" value="${extention.errormessage!'未配置机器人'}">
	            </div>
	        </div>
	        
	        <div class="layui-form-item">
	       		<label class="layui-form-label">无对话提示次数：</label>
		       	<div class="layui-input-inline" style="width:450px;" >
			        <select name="waittiptimes">
		            		<option value="1" <#if extention.waittiptimes?? && extention.waittiptimes == 1>selected</#if>>1次</option>
		            		<option value="2" <#if extention.waittiptimes?? && extention.waittiptimes == 2>selected</#if>>2次</option>
		            		<option value="3" <#if extention.waittiptimes?? && extention.waittiptimes == 3>selected</#if>>3次</option>
		            		<option value="4" <#if extention.waittiptimes?? && extention.waittiptimes == 4>selected</#if>>4次</option>
		            		<option value="5" <#if extention.waittiptimes?? && extention.waittiptimes == 5>selected</#if>>5次</option>
		            		<option value="6" <#if extention.waittiptimes?? && extention.waittiptimes == 6>selected</#if>>6次</option>
		            </select>
	            </div>
            </div>
	    </div>
        <div class="box-item" id="ai_bus" style="<#if !(extention?? && extention.aitype == 'businessai')>display:none;</#if>">	
	       	<div class="layui-form-item">
	       		<label class="layui-form-label">业务类型：</label>
		       	<div class="layui-input-inline" style="width:450px;" >
			        <select name="bustype"  lay-filter="bustype">
		            		<option value="">请选择业务类型</option>
		            		<option value="sale" <#if extention?? && extention.bustype == 'sale'>selected="selected"</#if>>业务话术</option>
		            		<option value="quesurvey" <#if extention?? && extention.bustype == 'quesurvey'>selected="selected"</#if>>调查问卷</option>
		            </select>
	            </div>
            </div>
	       	<div class="layui-form-item" id="pro" style="<#if extention?? && extention.bustype == 'sale'>display: inline;<#else>display: none;  </#if>">
	       		<label class="layui-form-label">业务话术：</label>
		       	<div class="layui-input-inline"  style="width:450px;"  >
			        <select name="proid">
		            	<option value="">请选择话术</option>
		            	<#list salesPatterList as salesPatter>
		            		<option value="${salesPatter.id}" <#if extention?? && extention.proid == salesPatter.id>selected="selected"</#if>>${salesPatter.name!''}</option>
		            	</#list>
		            </select>
	            </div>
            </div>
	       	<div class="layui-form-item" id="que" style="<#if extention?? && extention.bustype == 'quesurvey'>display: inline;<#else>display: none; </#if>">
	       		<label class="layui-form-label">问卷：</label>
		       	<div class="layui-input-inline" style="width:450px;" >
			        <select name="queid">
		            	<option value="">请选择问卷</option>
		            	<#list queList as que>
		            		<option value="${que.id}" <#if extention?? && extention.queid == que.id>selected="selected"</#if>>${que.name!''}</option>
		            	</#list>	
		            </select>
	            </div>
            </div>
	        
	    </div>
	    
	    <div class="box-item" id="ai_wait_time" style="<#if !(extention?? && extention.aitype??) || (extention?? && extention.aitype == 'ivr')>display:none;</#if>">
	       	<div class="layui-form-item">
	       		<label class="layui-form-label">无对话提示等待时长：</label>
		       	<div class="layui-input-inline" style="width:450px;" >
			        <select name="waittime">
		            		<option value="3000" <#if extention.waittime?? && extention.waittime == 3000>selected</#if>>3秒</option>
		            		<option value="4000" <#if extention.waittime?? && extention.waittime == 4000>selected</#if>>4秒</option>
		            		<option value="5000" <#if extention.waittime?? && extention.waittime == 5000>selected</#if>>5秒</option>
		            		<option value="6000" <#if extention.waittime?? && extention.waittime == 6000>selected</#if>>6秒</option>
		            		<option value="7000" <#if extention.waittime?? && extention.waittime == 7000>selected</#if>>7秒</option>
		            		<option value="8000" <#if extention.waittime?? && extention.waittime == 8000>selected</#if>>8秒</option>
		            		<option value="9000" <#if extention.waittime?? && extention.waittime == 9000>selected</#if>>9秒</option>
		            		<option value="10000" <#if extention.waittime?? && extention.waittime == 10000>selected</#if>>10秒</option>
		            </select>
	            </div>
            </div>
	    </div>

		<div class="box-item robot_vmd"  style="<#if !(extention?? && extention.aitype??) || (extention?? && extention.aitype == 'ivr')>display:none;</#if>">
			<div class="layui-form-item">
				<label class="layui-form-label">声音阀值
					<a id="scheme_1" href="javacript:void(0);"  onmouseenter="subtips=layer.tips('用户开始说话的声音阀值,越小越敏感,一般800,  >0有效', '#scheme_1',{tips:[1,'#ff6700'],time: 30000});" onmouseleave="layer.close(subtips);" >
						<i class="layui-icon layui-icon-about" style="font-size: 16px;"></i>
					</a>
					：</label>
				<div class="layui-input-inline" style="width:450px;" >
					<input type="text" name="soseng" value="${extention.soseng!800}" class="layui-input" autocomplete="off" lay-verify="number">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">静音阈值
					<a id="scheme_2" href="javacript:void(0);"  onmouseenter="subtips=layer.tips('用户说完之后没说话的静音阈值,一般400, >0有效', '#scheme_2',{tips:[1,'#ff6700'],time: 30000});" onmouseleave="layer.close(subtips);" >
						<i class="layui-icon layui-icon-about" style="font-size: 16px;"></i>
					</a>
					：</label>
				<div class="layui-input-inline" style="width:450px;" >
					<input type="text" name="eoseng" value="${extention.eoseng!400}" class="layui-input" autocomplete="off" lay-verify="number">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">说话停顿超时（ms）
					<a id="scheme_3" href="javacript:void(0);"  onmouseenter="subtips=layer.tips('用户说话停顿超时，说话结束,单位ms,越小越容易结束一般500, >0有效', '#scheme_3',{tips:[1,'#ff6700'],time: 30000});" onmouseleave="layer.close(subtips);" >
						<i class="layui-icon layui-icon-about" style="font-size: 16px;"></i>
					</a>
					：</label>
				<div class="layui-input-inline" style="width:450px;" >
					<input type="text" name="eostime" value="${extention.eostime!500}" class="layui-input" autocomplete="off" lay-verify="number">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">降噪强度
					<a id="scheme_4" href="javacript:void(0);"  onmouseenter="subtips=layer.tips('降噪强度，数值越大降噪效果越明显', '#scheme_4',{tips:[1,'#ff6700'],time: 30000});" onmouseleave="layer.close(subtips);" >
						<i class="layui-icon layui-icon-about" style="font-size: 16px;"></i>
					</a>
					：</label>
				<div class="layui-input-inline" style="width:450px;" >
					<select name="denoise">
						<#list 0..10 as min>
							<option value="${min}" <#if extention.denoise == min>selected="selected"</#if>>${min}</option>
						</#list>
					</select>
				</div>
			</div>
		</div>



        <div class="layui-form-button">
            <div class="layui-button-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
	layui.use('form', function(){
	  var form = layui.form;
	  form.render();
	  form.on("radio(enable_ivr)" , function(data){
		  $('#ai_tip').hide();		
		  $('#ai_bus').hide();
		  $('#ai_wait_time').hide();
		  $('.robot_vmd').hide();
	  });
	  form.on("radio(enable_ai)" , function(data){
		  $('#ai_tip').show();		
		  $('#ai_bus').hide();
		  $('#ai_wait_time').show();
		  $('.robot_vmd').show();
	  });
	  form.on("radio(bus_ai)" , function(data){
		  $('#ai_tip').hide();
		  $('#ai_bus').show();
		  $('#ai_wait_time').show();
		  $('.robot_vmd').show();
	  });
	  form.on("select(bustype)" , function(data){
		  var val = data.value;
		  if(val == 'sale'){
			  $('#pro').show();
			  $('#que').hide();
		  }else{
			  $('#pro').hide();
			  $('#que').show();
		  }
	  });
	});
</script>